const express = require("express");
const router = express.Router();
const remindModel = require("../model/remind.js");
const {send} = require("./send.js");

router.delete("/:id", async function(req , res){
    try {
        let { id } = req.params;
        await remindModel.findByIdAndDelete(id);
        send(res);
    } catch (error) {
        console.log(error);
        sendErr(res, { msg: "传入的数据可能有问题" });
    }
})

router.get("/" , async function(req , res){
    try {
        let { userid } = req.query;
        let remind = await remindModel.find({ idolId: userid });
        send(res, {
            data: remind
        })
    } catch (error) {
        console.log(error);
        sendErr(res, { msg: "传入的数据可能有问题" });
    }
})

module.exports = router;